﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

public static class SnmpOid
{
    public static string Model = ".1.3.6.1.2.1.1.1";
    public static string Vendor = ".1.3.6.1.2.1.1.2";
    public static string Uptime = ".1.3.6.1.2.1.1.3";
    public static string Hostname = ".1.3.6.1.2.1.1.5";
    public static string System = ".1.3.6.1.2.1.1";
    public static string Default = Hostname;
    private static Dictionary<OidNames, string> oidDictionary = new Dictionary<OidNames, string> ()
    {
        { OidNames.Model, Model }, 
        { OidNames.Vendor, Vendor},
        { OidNames.Uptime, Uptime},
        { OidNames.Hostname, Hostname},
        { OidNames.System, System},
    };
    
    public static OidNames TranslateOidToName(string oid)
    {
        if (oidDictionary.ContainsValue(oid))
        {
            return oidDictionary.FirstOrDefault(x => x.Value == oid).Key;
        }
        else
        {
            return OidNames.Hostname;
        }
    }
    public static String TranslateNameToOid(OidNames name)
    {
        if (oidDictionary.ContainsKey(name))
        {
            return oidDictionary.FirstOrDefault(x => x.Key == name).Value;
        }
        else
        {
            return Default;
        }
    }
}
